using KernelSyntaxExample.Utils;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Orchestration;

namespace KernelSyntaxExample;

public class Example04 {
    public async Task RunAsync() {
        // Create a kernel
        var kernel = new KernelBuilder().Configure(p => {
            // Add the Azure Chat Completion service
            p.AddAzureChatCompletionService(
                ProjectEnvironment.Get(ProjectEnvironment.AoaiDeploymentName),
                ProjectEnvironment.Get(ProjectEnvironment.AoaiEndpoint),
                ProjectEnvironment.Get(ProjectEnvironment.AoaiKey));
        }).Build();

        var sellerSkill = kernel.ImportSemanticSkillFromDirectory(
            ProjectFile.GetSkillsFolder(), "SellerSkill");

        var variables = new ContextVariables("这款车有什么颜色可选？");
        variables["preference"] = "喜欢红色车型";

        var result = await kernel.RunAsync(variables, sellerSkill["Chat"]);
        Console.WriteLine(result);
    }
}